<style>
	
</style>
<template>
<div>
    <Card :bordered="false" dis-hover>
        <p slot="title">匹配税务编码</p>
        <Row :gutter="20">
			<Col span="5">
				<Input v-model="search.goodsName" placeholder="名称" ></Input>
			</Col>
			<Col span="5">
				<Input v-model="search.goodsCode" placeholder="编码" ></Input>
			</Col>
			<Col span="5">
				<Input v-model="search.officalName" placeholder="税总商品名称" ></Input>
			</Col>
			<Col span="5">
				<Input v-model="search.officalCode" placeholder="税总商品编码" ></Input>
			</Col>
			
			<Col span="2">
				<Button type="primary" icon="ios-search" @click="getdata('search')">搜索</Button>
			</Col>
       	</Row>
       	<div style="margin-top:20px;">
       		<div class="ivu-table-wrapper" >
	            <div class="ivu-table ivu-table-with-fixed-top ">
	                <div class="ivu-table-body" >
	                    <table  class="table_border _table"   cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
		                   
		                    <thead>
			                    <tr>
			                        <th class="">
			                            <div class="ivu-table-cell">
			                                <span>商品编码</span>
			                            </div>
			                        </th>
			                        <th class="">
			                            <div class="ivu-table-cell">
			                                <span>名称</span>
			                            </div>
			                        </th>
			                        <th class="">
			                            <div class="ivu-table-cell">
			                                <span>匹配名称 </span>
			                            </div>
			                        </th>
			                         <th class="">
			                            <div class="ivu-table-cell">
			                                <span>匹配编码 </span>
			                            </div>
			                        </th>
			                        <th class="">
			                            <div class="ivu-table-cell">
			                                <span>	操作</span>
			                            </div>
			                        </th>
			                    </tr>
		                    </thead>
		                    <tbody class="ivu-table-tbody">
			                    <tr class="ivu-table-row"  v-for="item in data">
			                         <td class="">
			                            <div class="ivu-table-cell">
			                                <span>{{item.goodsCode}}</span>
			                            </div>
			                        </td>
			                        <td class="">
			                            <div class="ivu-table-cell">
			                                <span>{{item.goodsName}}</span>
			                            </div>
			                        </td>
			                        <td class="">
			                            <div class="ivu-table-cell">
			                                <span>	{{item.officalName}}</span>
			                            </div>
			                        </td>
			                        <td class="">
			                            <div class="ivu-table-cell">
			                                <span>	{{item.officalCode}}</span>
			                            </div>
			                        </td>
			                        <td class="">
			                            <div class="ivu-table-cell">
			                                <!-- <Button  size="small" @click="show()">查看</Button> -->
			                                <Button  size="small" @click="check(item)">匹配</Button>
			                            </div>
			                        </td>
			                    </tr>
		                    </tbody>
	                    </table>
	                    <div class="body_empty" v-if="data.length==0">
	                    	暂无数据
	                    </div>
	                </div>
	            </div>
	            
	        </div>
       	</div>
       	<div style="margin-top:20px;">
       		<Page  show-total :page-size="search.pageSize"	:total="pageParams.total" 
       		show-total @on-change="changePage" style="float:right;"></Page>
       	</div>
    </Card>
    <mechanism-edit @refresh="getdata"> </mechanism-edit>	
</div>	
</template>
<script>
import MechanismEdit from "../Module/mechanismedit.vue"
export default {
	components:{MechanismEdit},
	data (){
		return {
			modal:false,
			search:{goodsName:'',goodsCode:'',pageSize:15,currentPage:1},
			states:['真','未'],
			pageParams:{total:0},
			data:[
				
			]
		}
	},methods:{
		changePage (pageNum){
			this.search.currentPage = pageNum;
     		this.getdata();
		},getdata(type){
			if(type=='search'){
				this.search.currentPage=0;
			}
			this.axios.post('/user/usergoods/List',
				this.search).then((res)=>{
				console.log(res);
				var d=res.data.list;
				
				this.data=d;
				this.pageParams.total=res.data.total;
				//this.search.pageSize=res.data.pageSize
				this.search.currentPage=res.data.pageNo || 1;
			})
		},show(){
			this.modal=true;
		},check(item){
			this.$bus.emit('bus_mechanismedit',item.guid)
		}
	},mounted(){
		$('._table').resizableColumns({});
	},created(){
		this.getdata();
	},activated(){
		this.getdata();
	}
}
</script>